package com.sugree.twitter.tasks;

import java.util.Vector;

import com.substanceofcode.tasks.AbstractTask;
import com.substanceofcode.twitter.TwitterApi;
import com.sugree.twitter.TwitterController;
import com.sugree.twitter.TwitterException;

public class UpdateStatusTask extends AbstractTask {
	private TwitterController controller;
	private TwitterApi api;
	private String status;

	public UpdateStatusTask(TwitterController controller, TwitterApi api, String status) {
		this.controller = controller;
		this.api = api;
		this.status = status;
	}

	public void doTask() {
		try {
			api.updateStatus(status);
			controller.showTimeline();
		} catch (TwitterException e) {
			controller.showError(e, TwitterController.SCREEN_UPDATE);
		}
	}
}
